package com.ganlinux.pangoo.controller.restful.footmark;

import com.alibaba.fastjson.JSON;
import com.ganlinux.pangoo.controller.restful.base.BaseController;
import com.ganlinux.pangoo.dao.model.UserFootmarkList;
import com.ganlinux.pangoo.entity.request.ReqFootPrintMapInfoList;
import com.ganlinux.pangoo.entity.response.RspFootPrintMapInfoListData;
import com.ganlinux.pangoo.entity.response.base.RspBase;
import com.jfinal.aop.Before;
import com.jfinal.kit.HttpKit;

/**
 * BlogController
 * 所有 sql 与业务逻辑写在 Model 或 Service 中，不要写在 Controller 中，养成好习惯，有利于大型项目的开发与维护
 */
@Before(FootMarkMapInfoListInterceptor.class)
public class FootMarkMapInfoListController extends BaseController {
	public void save() {
		super.save();
		RspBase rspLogin = new RspBase();
		String pin = null;
		String countryId = "";
		String provinceId = "";
		String cityId = "";
		String districtId = "";
		int type = -1;
		String jsonString= HttpKit.readData(getRequest());
		ReqFootPrintMapInfoList reqFootPrintDelete = JSON.parseObject(jsonString, ReqFootPrintMapInfoList.class);
		reqFootPrintDelete.setReqHeader(getHeaderFromRequest(getRequest()));
		pin = reqFootPrintDelete.getReqHeader().getPin();
		countryId = reqFootPrintDelete.getCountryId();
		type = reqFootPrintDelete.getType();
		countryId = reqFootPrintDelete.getCountryId();
		provinceId = reqFootPrintDelete.getProvinceId();
		cityId = reqFootPrintDelete.getCityId();
		districtId = reqFootPrintDelete.getDistrictId();


		RspFootPrintMapInfoListData rspFootPrintMapInfoListData = UserFootmarkList.dao.getFootTravelMapInfoList(pin,countryId,provinceId,cityId,districtId,type);
		if (rspFootPrintMapInfoListData == null) {
			rspLogin.setStatus(1);
			rspLogin.setMessage("失败");
		}else {
			rspLogin.setData(rspFootPrintMapInfoListData);
			rspLogin.setStatus(0);
			rspLogin.setMessage("成功");
		}

		renderText(JSON.toJSONString(rspLogin));
	}

}


